package cn.assumejson.springframework.beans.factory;

import java.util.Map;

/**
 * @author Mr. Li
 * @version 1.0
 * @since 1.0 2021/11/30 14:59
 */
public interface ListableBeanFactory extends BeanFactory {

    boolean containsBeanDefinition(String beanName);

    /**
     * 按照类型返回 Bean 实例
     *
     * @param type
     * @param <T>
     * @return
     * @throws BeansException
     */
    <T> Map<String, T> getBeansOfType(Class<T> type) throws BeansException;

    /**
     * Return the names of all beans defined in this registry.
     * <p>
     * 返回注册表中所有的Bean名称
     */
    String[] getBeanDefinitionNames();

    /**
     * 根据类型获取BeanName
     *
     * @param type                 类型
     * @param includeNonSingletons 是否为单例
     * @param allowEagerInit       是否允许依赖注入
     * @return String[]
     */
    String[] getBeanNamesForType(Class<?> type, boolean includeNonSingletons, boolean allowEagerInit);
}
